


BasePanel = class("BasePanel")

function BasePanel:ctor(goParent, res, args)
    self.goParent = goParent
    self.go = nil

    local prefab = GameMgr.instance.resMgr:LoadAsset(res)
    local go = util.newObject(prefab,goParent.transform)
    self.go = go

    self._start = function()
        self:start()
    end
    
    self._onDestroy = function()
        self:onDestroy()
    end

    local luaBehaviour = go:AddComponent(typeof(CS.LuaBehaviour))
    luaBehaviour.bindingTable = self
    self.luaBehaviour = luaBehaviour
end

function BasePanel:start()
end

function BasePanel:onDestroy()

end

function BasePanel:StartCoroutine(routine)
	local xLuaUtil = require("xlua.util");
	local cor = function()
		return xLuaUtil.cs_generator(function()
			if routine then
				routine()
			end
		end)
	end
	local co = self.luaBehaviour:StartCoroutine(cor())
	return co
end

return BasePanel